<%--
  Created by IntelliJ IDEA.
  User: huangrulan
  Date: 2019/3/1
  Time: 10:19 AM
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>阿星影院后台管理</title>
    <link href="${base}/larryms/css/login/base.css" rel="stylesheet" media="all">
    <link href="${base}/larryms/css/login/login.css" rel="stylesheet" media="all">
    <link rel="stylesheet" type="text/css" href="${base}/assets/css/layui/layui.css" media="all">
    <style>
        .checkDiv{
            display: inline-block;
            margin-top: 10px;
            margin-left: 10px;
        }
        #checkCodePic {
            width: 90px;
            height: 37px;
        }
        .web_login .login_form {
            margin-top: 0px;
        }
        .layui-btn-normal {
            background-color: #5a76a6;
        }
        h1 {
            margin: 80px auto 50px auto;
            text-align: center;
            color: #fff;
            margin-left: -25px;
            font-size: 35px;
            font-weight: bold;
            text-shadow: 0px 1px 1px #555;
        }
        .errorMsg{
            text-align: center;
            font-size: 16px;
            color: #de3131;
        }
    </style>
</head>
<body id="by">
<div id="iframe-wrap">
    <h1>阿星影城后台管理</h1>
    <div class="login" style="margin-top:50px;">
        <div class="header">
            <div class="switch" id="switch">快速登录</div>
        </div>
        <div class="web_qr_login" id="web_qr_login" style="display: block;">
            <!--登录-->
            <div class="web_login" id="web_login">
                <div class="login-box">
                    <div class="login_form">
                        <form id="userForm" class="layui-form"
                              action="${base}/login/login.json" enctype="multipart/form-data" method="post">
                            <input type="hidden" name="to" value="log">

                            <div class="uinArea">
                                <label class="input-tips">帐号：</label>
                                <div class="inputOuter">
                                    <input type="text" name="userName" class="inputstyle">
                                </div>
                            </div>
                            <div class="pwdArea">
                                <label class="input-tips">密码：</label>
                                <div class="inputOuter">
                                    <input type="password" name="password" class="inputstyle">
                                </div>
                            </div>

                            <div class="uinArea">
                                <label class="input-tips" style="margin-left: -15px; width: 64px;">验证码：</label>
                                <div class="inputOuter" style="width: 100px;">
                                    <input type="text" name="code" class="inputstyle" style="width: 110px;">
                                </div>
                                <div class="checkDiv"><img id="checkCodePic" class="aui-child" src="verify.json"></div>
                            </div>

                            <div class="errorMsg">
                                <span>${error}</span>
                            </div>

                            <div style="margin-top:20px;">
                                <button class="layui-btn layui-btn-normal layui-btn-fluid"
                                        lay-submit lay-filter="login">登陆
                                </button>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
            <!--登录end-->
        </div>
    </div>
</div>

<!-- 加载js文件-->
<script type="text/javascript" src="${base}/assets/js/layui/layui.js"></script>
<script type="text/javascript">
    layui.config({
        version: "2.0.8",
        base: '${base}/larryms/',  //实际使用时，建议改成绝对路径
        identified: 'login',
        // mods: 'vip/',
        page: 'login',
        layertype: 2,
        rightMenu: true // false关闭，设置为custom时使用自定义，不使用默认menu
    }).extend({
        larry: 'js/base'
    }).use(['larry', 'form', 'layer'], function () {
        var $ = layui.$,
            larry = layui.larry, layer = layui.layer, form = layui.form;

        //提交表单
        form.on('submit(login)', function (data) {
            console.log(data.field);
            $.ajax({
                type: 'POST',
                url: '${base}/login/login.json',
                dataType: 'json',
                data: data.field,
                async: true,
                success: function (res) {
                    layer.msg('这里是msg内容');
                    console.log(res);
                    if (res.success) {
                        layer.msg(res.data, {icon: 1, time: 1500}, function () {
                            // location.reload();
                        });
                    } else {
                        layer.msg(res.msg, {icon: 5, time: 2000}, function () {
                            // location.reload();
                        });
                    }
                }, error: function () {
                    layer.msg("请求失败，请联系开发人员", {icon: 5, time: 2000}, function () {
                        // location.reload();
                    });
                }
            });
        });

    });
</script>
</body>
</html>
